package web;

import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import util.web.ServletUtil;

public class AlterPic extends HttpServlet {

	
	
	private static final long serialVersionUID = 1L;


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String picpath = request.getParameter("picpath");
		if (picpath != null) {
			request.setAttribute("picpath", picpath);
			ServletUtil.forward(request, response, "personcenter");
			return;
		}
		ServletUtil.forward(request, response, "personcenter");
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		Map<String, String> map = ServletUtil.upFile(request);
		String filename = map.get("filename");
		//request.setAttribute("picpath", filename);
		//request.getSession().setAttribute("picpath", filename);
		ServletUtil.sendRedirect(response, "alterpic.jspx?picpath="+filename);
	}

}
